package com.wzc.hc.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzc.hc.entity.po.Menu;
import com.wzc.hc.entity.po.Role;
import com.wzc.hc.mapper.MenuMapper;
import com.wzc.hc.service.MenuService;
import com.wzc.hc.service.RoleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author m1825
 * @description 针对表【menu】的数据库操作Service实现
 * @createDate 2025-03-05 16:14:11
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu>
        implements MenuService {
    @Resource
    private RoleService roleService;
    @Resource
    private MenuMapper menuMapper;

    @Override
    public List<Menu> getMenuListByUserId(String userId) {
        List<String> roleIds = roleService.getRoleListByUserId(userId).stream().map(Role::getId).toList();
        return menuMapper.getMenuListByUserId(roleIds);
    }
}




